<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <%@include file ="../include/link.jsp"%> 
        <script language="javascript" type="text/javascript">
            //删除
            /* function deleteAcount(no) {
                var r = window.confirm("确定要删除此账务账号吗？\r\n删除后将不能恢复，且会删除其下属的所有业务账号。");
                document.getElementById("operate_result_info").style.display = "block";
                document.getElementById("hi").value=no;
 				document.getElementById("hi").name="delete";
 				document.getElementById("myform").submit();
            } */
            function deleteAcount(no) {             
                  $("#hi").val(no);
                  $("#hi").attr("name","delete");
  				$.ajax({
          			url:'${pageContext.request.contextPath}/acount/DeleteAcountServlet',
          			type:"post",
          			data:$("#myform").serialize(),
          			success:function(result){
          				alert("删除成功");
          				$("#"+no).remove();
          				if(result==true){
  	        				setTimeout(function(){
  	        					$("#operate_result_info").show();
  	        				},3000)		        				
          				}
          			}
          		})
              }
          //修改
            function modifyAcount(no) {
            	 $("#hi").val(no);
                 $("#hi").attr("name","modify");
                 var path = "${pageContext.request.contextPath}/acount/DeleteAcountServlet";  
  			    $('#myform').attr("action", path).submit();;
            }
            //暂停
            function stopAcount(no) {
            	var r = window.confirm("确定要暂停此账务账号吗？");
                $("#operate_result_info").style.display = "block";
            	$("#hi").val(no);
                $("#hi").attr("name","stop");
   				$.ajax({
           			url:'${pageContext.request.contextPath}/acount/DeleteAcountServlet',
           			type:"post",
           			data:$("#myform").serialize(),
           			success:function(result){
           				alert("暂停成功");
           				$("#"+no).remove();
           				if(result==true){
   	        				setTimeout(function(){
   	        					$("#operate_result_info").show();
   	        				},3000)		        				
           				}
           			}
           		})
            }
            //开通
            function startAcount(no) {
                var r = window.confirm("确定要开通此账务账号吗？");
                $("#operate_result_info").style.display = "block";
 				$("#hi").val(no);
                $("#hi").attr("name","start");
   				$.ajax({
           			url:'${pageContext.request.contextPath}/acount/DeleteAcountServlet',
           			type:"post",
           			data:$("#myform").serialize(),
           			success:function(result){
           				alert("开通成功");
           				$("#"+no).remove();
           				if(result==true){
   	        				setTimeout(function(){
   	        					$("#operate_result_info").show();
   	        				},3000)		        				
           				}
           			}
           		})
            }
        </script>
    </head>
    <body>
        <!--Logo区域开始-->
        <div id="header">
           <img src="../images/logo.png" alt="logo" class="left" />
            <a href="#">[退出]</a>            
        </div>
        <!--Logo区域结束-->
        <!--导航区域开始-->
        <div id="navi">                        
            <ul id="menu">
                <%@include file ="../include/main.jsp"%>
            </ul>            
        </div>
        <!--导航区域结束-->
        <!--主要区域开始-->
        <div id="main">
            <form id="myform" action="" method="post">
            <%-- ${pageContext.request.contextPath}/acount/DeleteAcountServlet --%>
                <!--查询-->
                <div class="search_add">                        
                    <div>身份证：<input type="text" value="不验证" class="text_search" /></div>                            
                    <div>姓名：<input type="text" class="width70 text_search" value="不验证" /></div>
                    <div>登录名：<input type="text"  value="不验证" class="text_search"" /></div>
                    <div>
                        状态：
                        <select class="select_search">
                            <option>全部</option>
                            <option>开通</option>
                            <option>暂停</option>
                            <option>删除</option>
                        </select>
                    </div>
                    <div><input type="button" value="搜索" class="btn_search" /></div>
                    <input type="button" value="增加" class="btn_add" onclick="location.href='../view/account/account_add.jsp';" />
                </div>  
                <!--删除等的操作提示-->
                <div id="operate_result_info" class="operate_success">
                    <img src="../images/close.png" onclick="this.parentNode.style.display='none';" />
                    删除成功，且已删除其下属的业务账号！
                </div>   
                <!--数据区域：用表格展示数据-->     
                <div id="data">            
                    <table id="datalist">
                    <tr>
                        <th>账号ID</th>
                        <th>姓名</th>
                        <th class="width150">身份证</th>
                        <th>登录名</th>
                        <th>状态</th>
                        <th class="width100">创建日期</th>
                        <th class="width150">上次登录时间</th>                                                        
                        <th class="width200"></th>
                    </tr>
                    <c:forEach items="${la}" var="aco" >
                    <tr>
                        <td>${aco.aco_no}</td>
                        <td><a href="${pageContext.request.contextPath}/acount/DetailAcoServlet?aco_no=${aco.aco_no}">${aco.aco_name}</a></td>
                        <td>${aco.aco_card}</td>
                        <td>${aco.aco_user}</td>
                        <td><c:if test="${aco.aco_state==1}">开通</c:if>   
                        	<c:if test="${aco.aco_state==0}">暂停</c:if>
                        	<c:if test="${aco.aco_state==-1}">删除</c:if>  
                         </td>
                        <td>${aco.aco_ctime}</td>
                        <td>${aco.aco_llog }</td> 
                                              
                        <td class="td_modi">
                         <c:if test="${aco.aco_state==1 }">  
                            <input type="button" value="暂停" class="btn_pause" onclick="stopAcount(${aco.aco_no})" />
                            <input type="button" value="修改" class="btn_modify" onclick="modifyAcount(${aco.aco_no})" />
                            <input type="button" value="删除" class="btn_delete" onclick="deleteAcount(${aco.aco_no})" />
                       	 </c:if>
                        <c:if test="${aco.aco_state==0 }">  
                            <input type="button" value="开通" class="btn_start" onclick="startAcount(${aco.aco_no});" />
                            <input type="button" value="修改" class="btn_modify" onclick="modifyAcount(${aco.aco_no})" />
                            <input type="button" value="删除" class="btn_delete" onclick="deleteAcount(${aco.aco_no})" />
                        </c:if> 
                        </td>                                                                                             
                        <input type="hidden" id="hi" name="" value=""/>
                    </tr>
                    </c:forEach>                    
                </table>
                <p>业务说明：<br />
                1、创建则开通，记载创建时间；<br />
                2、暂停后，记载暂停时间；<br />
                3、重新开通后，删除暂停时间；<br />
                4、删除后，记载删除时间，标示为删除，不能再开通、修改、删除；<br />
                5、暂停账务账号，同时暂停下属的所有业务账号；<br />                
                6、暂停后重新开通账务账号，并不同时开启下属的所有业务账号，需要在业务账号管理中单独开启；<br />
                7、删除账务账号，同时删除下属的所有业务账号。</p>
                </div>                   
                <!--分页-->
                <div id="pages">
                    <a href="#">首页</a>
        	        <a href="#">上一页</a>
                    <a href="#" class="current_page">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                    <a href="#">4</a>
                    <a href="#">5</a>
                    <a href="#">下一页</a>
                    <a href="#">末页</a>
                </div>                    
            </form>
        </div>
        <!--主要区域结束-->
        <div id="footer">
            
        </div>
    </body>
</html>
